import java.util.HashSet;
import java.util.Set;

/**
 * @Author wonghiu
 * @Date 2021/6/7 13:53
 * @Version 1.0.1
 */
class Solution {
    public int findRepeatNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int num:nums)
        {
            if (set.contains(num)){
                return num;
            }
            set.add(num);
        }
        return -1;
    }
}